{% extends "base_site.html" %}

{% block content %}

<link rel="stylesheet" type="text/css" href="/media/css/forms.css" /> 
<!--[if lte IE 7]><link rel="stylesheet" type="text/css" href="/media/css/ie.css" /><![endif]-->

<h1>{{ rrd.name|title }} - {{ widget.title|title }}</h1>
<form action="" method="GET" id = "check">
<fieldset class="module aligned ">
	<div class="form-row title"> 
	    <div> 
			<label for="id_date" class="required">Date:</label> 
			<p class="datetime"><input name="date" value="{{ show_date }}" class="vDateField" type="text" id="id_date" size="11"><span class="datetimeshortcuts"></span></p>
			&nbsp;&nbsp;&nbsp;&nbsp;
			<h class="required">
			{% for line in check_line_values%}	
			<h><input type='checkbox' class='usercheck' name = {{line.line}} value = {{line.line}} {{ line.checked }} />{{line.line}}</h>&nbsp;
			{% endfor %}
			<h><input type='checkbox' id='chkAll' value = "checkall" {{checkall}} onclick='select_all()'/>All</h></h><br>
			<h class="required">
			<input type="submit" value = "Show Date" />
			<input type="submit" value="With Yesterday" name="show1d"  /> 
			<input type="submit" value="With Yesterday and last week" name="show1w" />
			<input type="button" value="Download Data" id="download" name="download" />
			&nbsp;&nbsp;&nbsp;&nbsp;
			<input name="withdate" value="{{ withdate }}" class="vDateField" type="text" id="id_date" size="11"><span class="datetimeshortcuts"></span>
			<input type="submit" value="With Any Date" name="withAnyDate" />
			</h>
	    </div> 
	</div>
</fieldset>
</form>

<div id="download_div" style="display:none;width:800px">
	<form action="/rrd/img/{{ rrd.id }}/download" method="GET">
		<label for="id_date_start" class="required">Start:</label> 
		<input name="start" value="{{ show_date }}" class="vDateField" type="text" id="id_date_start" size="11"><span class="datetimeshortcuts"></span>
		<label for="id_date_end" class="required">End:</label> 
		<input name="end" value="{{ show_date }}" class="vDateField" type="text" id="id_date_end" size="11"><span class="datetimeshortcuts"></span>
			<input type="submit" value="Download"  />
	</form>
</div>

<a href="/dashboard/{{dashboard_id}}/widget/{{widget.id}}/parse" target="rightFrame"><img src="/rrd/img/{{ widget.id }}/?&start={{ start }}&end={{ end }}&height=480&width=1000&{{ graph_option }}&cl={{check_lines}}&withDate={{ withdate }}" height="480" width="1000" /></a></br>
<script type="text/javascript" src="/admin/jsi18n/"></script>
<script type="text/javascript" src="/media/js/core.js"></script>
<script type="text/javascript" src="/media/js/calendar.js"></script>
<script type="text/javascript" src="/media/js/admin/DateTimeShortcuts.js"></script>
<script type="text/javascript" src="/media/js/jquery.min.js"></script>
<script type="text/javascript" src="/media/js/jquery.min.js"></script>
<script type="text/javascript" src="/media/js/jquery.init.js"></script> 
<script type="text/javascript" src="/media/js/actions.min.js"></script>


<script type="text/javascript"> 

$(function() { 
	$("#download").click(function(){
		$("#download_div").toggle();		
	});
});
</script>

<script type = 'text/javascript'>
$(document).ready( function(){
$('#check input:checkbox.usercheck').click(function(){
if (this.checked){
if ($('#check input:checked.usercheck').length == $('#check input.usercheck').length){
$('#chkAll')[0].checked = true;
}
}else{
$('#chkAll')[0].checked = false;
}
});
});
function select_all(){
var e = $('#chkAll')[0].checked;
$('#check input:checkbox.usercheck').each(function(){
this.checked = e;
});
}
</script>

{% endblock %}

